package com.springboot.demo.response;

public class CommonReturnType {
    //表明对应返回的结果，有success 和 fail
    private String status;

    //若status是success 则data为要返回json的实际数据
    private Object data;
    //运用重载 判断data是给成功的结果或是错误的通用json
    public static CommonReturnType create(Object result){
        return create(result,"success");
    }
    public static CommonReturnType create(Object result,String status){
        CommonReturnType crt = new CommonReturnType();
        crt.setStatus(status);
        crt.setData(result);
        return crt;
    }
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
